﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ODS.Utils
{
    public class CommonUtil
    {
        public static DateTime ParseDateTimeFromString(String dateTimeString)
        {
            DateTime dateTime = DateTime.MinValue;
            try{
                //, "yyyy-MM-dd'T'HH:mm:ss.SSSZ", CultureInfo.InvariantCulture
                dateTime = DateTime.Parse(dateTimeString);
            }catch(Exception e)
            {
                try {
                    dateTime = DateTime.ParseExact(dateTimeString, "yyyy-mm-ddZ", CultureInfo.InvariantCulture);
                }
                catch (Exception ex)
                {

                }
            }

            return dateTime;
        }
    }
}
